package examination.WeBank_09_13;

import java.util.*;

/**
 * 最大拼接次数
 */

public class Question1 {
    public static void main(String[] args)  {
        Scanner in = new Scanner(System.in);
        while (in.hasNext()) {
            int n = in.nextInt();
            List<String> list = new ArrayList<>(n);
            for (int i = 0; i < n; i++) {
                list.add(in.next());
            }
            // 先按着大小排序，选出最大的三个数
            Collections.sort(list, (o1, o2) -> Integer.parseInt(o2) - Integer.parseInt(o1));
            List<String> subList = list.subList(0, 3);
            // 再按字典排序,得到最大拼接数
            Collections.sort(subList, Comparator.reverseOrder());
            StringBuilder sb = new StringBuilder();
            for (String str : subList) {
                sb.append(str);
            }
            System.out.println(sb.toString());
        }
    }
}